<template>
  <div>
    <div>
      <el-row>
        <el-col :span="8">
          <div class="grid-content bg-purple">
            <div class="block">
              <span class="demonstration">订单时间</span>
              <el-date-picker
                v-model="date"
                type="daterange"
                align="right"
                unlink-panels
                range-separator
                start-placeholder
                end-placeholder
                :picker-options="pickerOptions"
                @blur="searchfun2"
              ></el-date-picker>
            </div>
          </div>
        </el-col>
        <el-col :span="7">
          <div class="grid-content bg-purple-light">
            <div class="type">
              <span class="demonstration">订单类型</span>

              <el-input
                v-model="input"
                placeholder="全部"
                class="input"
                @blur="searchfun1"
              ></el-input>
            </div>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content">
            <el-input
              placeholder="请输入患者姓名/订单编号"
              v-model="search"
              class="input-with-select"
              clearable
            ></el-input>
            <el-button
              slot="append"
              icon="el-icon-search"
              class="icon"
              @click="searchfun"
            ></el-button>
          </div>
        </el-col>
      </el-row>
    </div>
    <div class="total2">
      <el-row :gutter="20" class="main">
        <el-col :span="4" class="left">
          <div class="grid-content bg-purple">
            <p class="income">合计收入(元)</p>
            <p class="yuan">{{ num1 }}</p>
          </div>
        </el-col>
        <el-col :span="20" class="right">
          <div class="grid-content bg-purple">
            <el-row>
              <el-col :span="4">
                <div class="grid-content bg-purple">
                  <p class="income">应收合计(元)</p>
                  <p class="yuan">{{ num2 }}</p>
                  <p class="income">医保(元)</p>
                  <p class="yuan">{{ num3 }}</p>
                </div>
              </el-col>
              <el-col :span="4">
                <div class="grid-content bg-purple-light">
                  <p class="income">优惠合计(元)</p>
                  <p class="yuan">{{ num4 }}</p>
                  <p class="income">会员(元)</p>
                  <p class="yuan">{{ num5 }}</p>
                </div>
              </el-col>
              <el-col :span="4">
                <div class="grid-content bg-purple">
                  <p class="income">实收合计(元)</p>
                  <p class="yuan">{{ num6 }}</p>
                  <p class="income">现金(元)</p>
                  <p class="yuan">{{ num7 }}</p>
                </div>
              </el-col>
              <el-col :span="4">
                <div class="grid-content bg-purple-light">
                  <p class="income">&nbsp;</p>
                  <p class="yuan">&nbsp;</p>
                  <p class="income">支付宝(元)</p>
                  <p class="yuan">{{ num8 }}</p>
                </div>
              </el-col>
              <el-col :span="4">
                <div class="grid-content bg-purple">
                  <p class="income">&nbsp;</p>
                  <p class="yuan">&nbsp;</p>
                  <p class="income">微信(元)</p>
                  <p class="yuan">{{ num9 }}</p>
                </div>
              </el-col>
              <el-col :span="4">
                <div class="grid-content bg-purple-light">
                  <p class="income">&nbsp;</p>
                  <p class="yuan">&nbsp;</p>
                  <p class="income">银行卡(元)</p>
                  <p class="yuan">{{ num0 }}</p>
                </div>
              </el-col>
            </el-row>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import Mock from "mockjs";

export default {
  data() {
    return {
      pickerOptions: {
        shortcuts: [
          {
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            },
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            },
          },
        ],
      },
      value1: "",
      input: "",
      search: "",
      date: "",
      num0: Mock.mock("@float(10000, 200000, 0, 2)"),
      num1: Mock.mock("@float(10000, 50000, 0, 2)"),
      num2: Mock.mock("@float(10000, 200000, 0, 2)"),
      num3: Mock.mock("@float(10000, 20000, 0, 2)"),
      num4: Mock.mock("@float(10000, 80000, 0, 2)"),
      num5: Mock.mock("@float(10000, 200000, 0, 2)"),
      num6: Mock.mock("@float(10000, 200000, 0, 2)"),
      num7: Mock.mock("@float(10000, 200000, 0, 2)"),
      num8: Mock.mock("@float(10000, 200000, 0, 2)"),
      num9: Mock.mock("@float(10000, 60000, 0, 2)"),
    };
  },
  methods: {
    searchfun() {
      this.$emit("searchParent", this.search);
    },
    searchfun1() {
      this.$emit("searchParent1", this.input);
    },
    searchfun2() {
      this.$emit("searchParent2", this.date);
    },
  },
};
</script>

<style lang="less" scoped>
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
.Total {
  margin-left: 30px;
}
.block {
  display: flex;
  align-items: center;
  // margin-left: 30px;
  .demonstration {
    margin-right: 5px;
  }
  .el-date-editor--daterange.el-input,
  .el-date-editor--daterange.el-input__inner,
  .el-date-editor--timerange.el-input,
  .el-date-editor--timerange.el-input__inner {
    width: 220px;
    margin-right: 20px;
  }
}
.type {
  display: flex;
  align-items: center;
  .input {
    width: 150px;
  }
  .demonstration {
    margin-right: 20px;
  }
}
.input-with-select {
  width: 200px;
  // border: 1px solid #666ee8;
}
// .icon {
//   background-color: #666ee8;
//   border: 1px solid #666ee8;
//   // width: 50px;
// }
.total2 {
  margin-top: 24px;
  // margin-left: 30px;
  margin-right: 30px;

  .grid-content {
    height: 110px;
    background-color: #fffae9;
    text-align: center;
    font-size: 14px;
    overflow: hidden;
  }
}

.left {
  .income {
    margin-top: 34px;
  }
  .yuan {
    font-size: 18px;
    color: purple;
    margin-top: 10px;
  }
}
.right {
  .income {
    margin-top: 14px;
  }
  .yuan {
    margin-top: 10px;
    color: purple;
  }
}
</style>